package com.jarveis.dbs.core;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;

/**
 * @desc Servcie上下文
 * @author liuguojun
 * @create 2015-08-09
 */
public class ServiceFactory {
	
	private static final Logger logger = Logger.getLogger(ServiceFactory.class);
	
	private static Map<String, Service> serviceStore = new HashMap<String, Service>();

	/**
	 * 获取Servcie
	 * 
	 * @param funcId
	 * @return
	 */
	public static Service getService(String funcId) {
		Service service = serviceStore.get(funcId);
		if (service == null) {
			logger.info("系统异常，访问的接口不存在");
			return null;
		}

		return service;
	}
	
	/**
	 * 设置Service
	 * 
	 * @param funcId
	 * @param service
	 */
	public static void putService(String funcId, Service service) {
		serviceStore.put(funcId, service);
	}
}
